<template>
    <v-container>
        <!-- <p>{{$route.params.type}}</p> -->
        <div v-if="bookList != null">
            <v-card prepend-icon="mdi-home" v-for="book in bookList" :key="book.bookId" :to="'/word_list/'+book.bookId">
                <template v-slot:title>
                    {{ book.bookName }}({{ book.bookCount }})
                </template>
                <v-card-text>
                    {{ book.bookDesc }}
                </v-card-text>
            </v-card>
        </div>

    </v-container>
</template>

<script>
export default {
    data() {
        return {
            bookParam: this.$route.params.type,
            bookList: null
        }
    },
    created() {
        this.loadBookList()
    },
    methods: {
        loadBookList() {
            if (this.bookParam == 'default') {
                fetch('/list_book_default', { method: 'get' }).then(resp => {
                    resp.json().then(data => {
                        if (data.code != '200') {
                            return
                        }
                        this.bookList = data.data
                    })
                })
                return
            }
        }
    }
}
</script>

<style scoped></style>